{// 加载头部公共文件 }
<include file="Public:header" />
<div class="main">
	<div class="content">
		<table id="checkList" class="list" cellpadding=0 cellspacing=0>
			<tr>
				<td height="3" colspan="2" class="toptd"></td>
			</tr>
			<tr class="row">
				<th colspan="2" class="space">创建角色</th>
			</tr>
			<tr class="row">
				<td width="15%">玩家ID(accid):</td>
				<td>
					99<input type="text" id="accid" name="accid"  style="width:22px"/>
					<button onclick="checkUser()">查询</button>
					用户ID为:<span id="userinfo"></span>
				</td>
			</tr>
			<tr class="row">
				<td width="15%">帐号名称(accname):</td>
				<td>
					<input type="text" id="accname" name="accname"  style="width:52px"/>
				</td>
			</tr>
			<tr class="row">
				<td width="15%">角色名称(name):</td>
				<td>
					<input type="text" id="name" name="name"  style="width:52px"/>
				</td>
			</tr>
			<tr class="row">
				<td width="15%">种族||职业(career)1-5:</td>
				<td>
					<input type="text" id="career" name="career"  style="width:52px"/>
				</td>
			</tr>
			<tr class="row">
				<td width="15%">性别:</td>
				<td>
					<select id="sex">
						<option value="1">男</option>
						<option value="2">女</option>
					</select>
				</td>
			</tr>
			<tr class="row">
				<td width="15%">线路:</td>
				<td>
					<input type="text" id="sn" name="sn"  style="width:22px"/>
				</td>
			</tr>
			<tr class="row">
				<td width="15%">登陆串:</td>
				<td>
					<input type="text" id="uname" name="uname"  style="width:52px"/>
					<button onclick="generat()">生成</button>
					<span id="loginstr"></span>
				</td>
			</tr>
			<tr class="row">
				<td colspan="2">
					<button onclick="createUser()">创建</button>
				</td>
			</tr>
		</table>
	</div>
</div>
<!-- 主页面结束 -->
{// 加载尾部公共文件 }
<script type="text/javascript">
	var cdn_path	=	"http://1251001850.cdn.myqcloud.com/1251001850/xbmc/icon/goodsPic/";
	var beginnum	=	99;
	
	function generat()
	{
		var urldata	=	{};
		urldata.name	=	$("#uname").val();
		$.get("{:U('Game/genurl')}",urldata, function(data) {
			$("#loginstr").html(data);
		});
	}
	
	//封玩家号(角色)
	function createUser()
	{
		var urldata	=	{};
		urldata.accid	=	"99"+$("#accid").val();
		urldata.accname	=	$("#accname").val();
		urldata.name	=	$("#name").val();
		urldata.career	=	$("#career").val();
		urldata.sex	=	$("#sex").val();
		urldata.sn	=	$("#sn").val();
		$.get("{:U('Game/createUser')}",urldata,function(data){
			alert(urldata.accname+"创建成功。");
		});
	}
	
	function resetAll()
	{
		
	}
	
	function enableAll()
	{
	}
	var userid	=	"";
	var username	=	"";
	/**
	* 检查玩家
	**/
	function checkUser()
	{
		username	=	$("#uname").val();
		var urldata	=	{};
		urldata.type	=	"user";
		urldata.name	=	username;
		//var econtent = escape(username);
		$.get("{:U('Game/query')}",urldata, function(data) {
			if(data=="")
			{
				//玩家不存在
				resetAll();
			}
			else
			{
				enableAll();
				userid	=	data;
				$("#userinfo").html(userid);
			}
		});
	}
	
</script>